<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>佣金核算</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <link rel="stylesheet" href="${ctx}/css/ui/activity/member_act_list.css">
    <%@include file="../include/commonFile.jsp" %>
</head>
<body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <form class="layui-form" action="${ctx}/copartner/brokerage/verifyList.do" id="myForm" method="post">
                <input type="hidden" name="pageNo" id="pageNo" value="${page.page}"/>
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <li class="form-item-inline">
                                <label class="search-form-lable">审核状态</label>
                                <div class="layui-input-inline">
                                    <select name="checkStatus">
                                        <option value="">全部</option>
                                        <c:forEach var="map" items="${checkStatusMap}">
                                            <c:if test="${instance.checkStatus == map.key}">
                                                <option value="${map.key}" selected="selected">${map.value}</option>
                                            </c:if>
                                            <c:if test="${instance.checkStatus != map.key}">
                                                <option value="${map.key}">${map.value}</option>
                                            </c:if>
                                        </c:forEach>
                                    </select>
                                </div>
                            </li>
                            <li class="form-item-inline"><label class="search-form-lable">合伙人昵称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="memberName" autocomplete="off" class="layui-input"
                                           value="${input.memberName}" placeholder="请输入查询合伙人昵称">
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger" href="javascript:submitFunction('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal" href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item"><label class="search-form-lable">审核时间</label>
                                <div class="check-btn-inner" id="timeType">
                                    <a id="all" href="javascript:void(0);" onclick="setTimeType($(this),0,'#myForm')" ${empty input.timeType || input.timeType == 0 ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);" onclick="setTimeType($(this),1,'#myForm')" ${input.timeType == 1 ? 'class="active"' : ''}>今天</a>
                                    <a href="javascript:void(0);" onclick="setTimeType($(this),2,'#myForm')" ${input.timeType == 2 ? 'class="active"' : ''}>本周内</a>
                                    <a href="javascript:void(0);" onclick="setTimeType($(this),3,'#myForm')" ${input.timeType == 3 ? 'class="active"' : ''}>本月内</a>
                                    <input type="hidden" name="timeType" value="${input.timeType}"/>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createStart" value="${input.createStart}" placeholder="开始日">
                                    </div>
                                    -
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createEnd" value="${input.createEnd}" placeholder="截止日">
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="my-act-list-content">
                <%--<ul class="num">
                    <div class="l">
                        <li class="f16">审核次数<span class="red">${page.totalCount}</span>次</li>
                    </div>
                    <div class="l">
                        <li style="cursor: pointer;" class="r"><a class="layui-btn layui-btn-danger layui-btn-sm" id="btnExport">导出EXCEL</a></li>
                    </div>
                    <p class="cl"></p>
                </ul>--%>
                <div class="cl">
                    <table class="layui-table" id="myTable">
                        <colgroup>
                            <col width="12%">
                            <col>
                            <col width="12%">
                            <col width="12%">
                            <col width="9%">
                            <col width="8%">
                            <col width="8%">
                            <col width="12%">
                            <col width="8%">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>合伙人</th>
                            <th>项目名称</th>
                            <th>众筹者</th>
                            <th>众筹成功时间</th>
                            <th>项目金额</th>
                            <th>佣金</th>
                            <th>审核状态</th>
                            <th>提交审核时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="result" items="${resultList}">
                            <tr class="info">
                                <td class="table-member" onclick="openDialogShow('用户名片','${ctx}/system/member/memberView.do?id=${result.partnerId}','400px','470px')">
                                    <div class="member-cell">
                                        <div class="member-logo common-img" >
                                            <img src="${result.logo}" alt="" onerror="txz.errImg(this)" onload="txz.imgLoad(this)">
                                        </div>
                                        <div class="member-name ellipsis-1">
                                            <a class="blue" title="${result.realname}" href="javascript:void(0);">${result.realname}</a>
                                        </div>
                                    </div>
                                </td>
                                <td class="ellipsis-1" title="${result.title}">${result.title}</td>
                                <td class="table-member" onclick="openDialogShow('用户名片','${ctx}/system/member/memberView.do?id=${result.authorId}','400px','470px')">
                                    <div class="member-cell">
                                        <div class="member-logo common-img" >
                                            <img src="${result.authorLogo}" alt="" onerror="txz.errImg(this)" onload="txz.imgLoad(this)">
                                        </div>
                                        <div class="member-name ellipsis-1">
                                            <a class="blue" title="${result.authorName}" href="javascript:void(0);">${result.authorName}</a>
                                        </div>
                                    </div>
                                </td>
                                <td><fmt:formatDate value="${result.successDate}" pattern="yyyy-MM-dd HH:mm"/></td>
                                <td>¥<fmt:formatNumber pattern="0.00" value="${result.totalPrice}"/>元</td>
                                <td>¥<fmt:formatNumber pattern="0.00" value="${result.brokerage}"/>元</td>
                                <td>
                                    <span><c:if test="${result.checkStatus == 1}">待审核</c:if></span>
                                    <span class="green"><c:if test="${result.checkStatus == 4}">审核中</c:if></span>
                                    <span class="red"><c:if test="${result.checkStatus == 5}">通过</c:if></span>
                                    <span><c:if test="${result.checkStatus == 6}">拒绝</c:if></span>
                                </td>
                                <td><fmt:formatDate value="${result.updateDate}" pattern="yyyy-MM-dd HH:mm"/></td>
                                <td class="opts-btns tb-opts" style="width: 150px">
                                    <div class="comm-opts">
                                        <c:if test="${result.checkStatus == 1}">
                                            <a class="red" href="${ctx}/copartner/brokerage/verifyForm.do?instanceId=${result.id}">核算</a>
                                        </c:if>
                                        <a class="green" href="${ctx}/copartner/brokerage/verifyDetail.do?type=check&instanceId=${result.id}">详情</a>
                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <div id="page_content" class="page-container"></div>
                </div>
            </div>
        </div><!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript">

    <%--showActive('${input.createStart}', '${input.createEnd}', '#timeType');--%>


    function checkMoney(content, instanceId, checkStatus) {
        layer.confirm(content, {
            icon: 3,
            title: '系统提示'
        }, function (index) {
            layer.close(index);
            $.post("${ctx}/copartner/brokerage/checkMoney.do", {
                instanceId: instanceId,
                checkStatus: checkStatus
            }, function (data) {
                if (data.success == true) {
                    util.layerMsgSuccess("审核成功", function () {
                        window.location.reload();
                    })
                } else {
                    util.layerMsgError("审核失败")
                }
            })
        });
    }

    function checkWithdrawal(content, instanceId, checkStatus) {
        layer.confirm(content, {
            icon: 3,
            title: '系统提示'
        }, function (index) {
            layer.close(index);
            $.post("${ctx}/copartner/brokerage/checkWithdrawal.do", {
                instanceId: instanceId,
                checkStatus: checkStatus
            }, function (data) {
                if (data.success == true) {
                    util.layerMsgSuccess("审核成功", function () {
                        window.location.reload();
                    })
                } else {
                    util.layerMsgError("审核失败")
                }
            })
        });
    }

    $(function () {

        //加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });
        layui.use(['laydate'], function () {
            var laydate = layui.laydate;
            // 查询发布日期
            var start = {
                elem: 'input[name=createStart]'
            };

            var end = {
                elem: 'input[name=createEnd]'
            };
            laydate.render(start);
            laydate.render(end);
        });

        $("#btnExport").click(function () {
            layer.confirm('确认要导出Excel吗?', {
                icon: 3,
                title: '系统提示'
            }, function (index) {
                var url = "${ctx}/wallet/withdrawals/exportWithdrawal.do";
                //loading层
                var loadIndex = layer.load(1, {
                    shade: [0.1, '#fff'] //0.1透明度的白色背景
                });
                $.post(url, $("#myForm").serialize(), function (res) {
                    if (res.success) {
                        top.layer.close(loadIndex);
                        window.open('${qr_code}/' + res.data);
                    } else {
                        util.layerMsgError(res.description)
                    }
                });
                top.layer.close(index);
            });
        });
    })
</script>
<script type="text/javascript">
    txz.initHeader({
        nav:[{
            name: '佣金核算',
            curr: true
        }],
        info:'<span class="f12">共<b id="totalCount">${page.totalCount}</b>条记录</span>'
    });
</script>
</body>
</html>